#ifndef __LOG_LEVEL__
#define __LOG_LEVEL__

#include<iostream>
#include<string>
#include<thread>
#include<sstream>

#include<stdio.h>

#define ERR_LEVEL 0
#define WAR_LEVEL 1
#define INF_LEVEL 2
#define DBG_LEVEL 3

extern int level_log;

#define LOG(level,val,message,...)                  \
    do{                                             \
        if(level<=level_log)                        \
            printf("[%-5s]" "[%s:%d]" message, val,   \
            __FUNCTION__, __LINE__, ##__VA_ARGS__); \
    }while(0)

#define ERR_LOG(message, ...) LOG(ERR_LEVEL,"error",message,##__VA_ARGS__)
#define WAR_LOG(message, ...) LOG(WAR_LEVEL,"warning",message,##__VA_ARGS__)
#define INF_LOG(message, ...) LOG(INF_LEVEL,"info",message,##__VA_ARGS__)
#define DBG_LOG(message, ...) LOG(DBG_LEVEL,"debug",message,##__VA_ARGS__)

//用于测试接口
int set_level(int level);

std::string tid_to_str(const std::thread::id& tid);

long long tid_to_ll(const std::thread::id& tid);

#endif